e
#Title[ϐuXm[o[hEvZXv]
#Text[NC~bgE`FW
ϐuXm[o[hEvZXv]
#BackGround[User]
#BGM[.\..\bgm\bgm.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	
	////////////////////////////////////////////////////////////////////////
	//                                                          //
	//   Ȃ                                                             //
	////////////////////////////////////////////////////////////////////////
	
	@Initialize{
		InitializeData();
		
		LoadUserShotData(shot_ryoyan);
		
		SetLife(1000);
		SetDamageRate(18,16);
		SetInvincibility(240);
		SetCollisionEx(32,16);
		SetEnemyMarker(true);
		
		move01(GetCenterX(),GetCenterY()-110,120,165,30,10);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		wait(60);
		
		DeclareSpell();
		
		Atack();
		Move();
	}
	
	function DeclareSpell(){
		SetTimer(90);
		CutIn(YOUMU,"ϐuXm[o[hEvZXv",NULL,0,0,0,0);
		SetScore(1000000);
		wait(180);
	}
	
	task Atack(){
		PT1();
		wait(120);
		PT2();
		wait(180);
		PT3();
	}
	
	task PT1() {
		let y=GetClipMinY();
		loop{
			let x=rand(GetClipMinX(),GetClipMaxX());
			CreateShot01(x,y,rand(0.7,2),90+rand(-2,2),_WHITE01L(),30);
			wait(4);
		}
	}
	
	task PT2() {
		let count=0;
		loop{
			let x=GetX();
			let y=GetY();
			let ang=GetAngleToPlayer();
			ascent(i in -10..11) {
				CreateShotA(0,x,y,0);
				SetShotDataA(0,0,2,ang-180+i*8,0,-0.02,0,_WHITE01L());
				SetShotKillTime(0,101);
				ascent(ii in 0..3){
					let ang2=ang+ii*120+i*14;
					let angpl=1.5*p1m0(count);
					ascent(iii in 1..4){
						CreateShotA(1,0,0,20);
						SetShotDataA(1,0,0,ang2,angpl,0.02,3,_WHITE22());
						SetShotDataA(1,90,NULL,NULL,0,0.01*iii,4,_WHITE22());
						AddShot(100,0,1,0);
					}
				}
				FireShot(0);
			}
			wait(130);
			ang=rand(0,360);
			ascent(i in 0..20) {
				ascent(ii in 0..3) {
					CreateShotA(0,x,y,0);
					SetShotDataA(0,0,2,ang+i*18,0,0,0,_RED03());
					SetShotDataA(0,90,NULL,NULL,0,0.01*ii,3,NULL);
					FireShot(0);
				}
			}
			count++;
			wait(60);
		}
	}
	
	task PT3() {
		let count=0;
		let y=GetClipMaxY();
		loop{
			loop(10){
				loop(12){
					let x=rand(GetClipMinX(),GetClipMaxX());
					let id=CreateShot01(x,y,0,0,_WHITE01L(),20);
					AA_TimeDelete(id,240,false);
					wait(2);
				}
				y-=1;
			}
			CreateLaserObjA(GetClipMinX()-50,y+10,0,500,20,_WHITE14(),0,false);
			count++;
		}
	}
	
	task Move(){
	}
	
	#include_function ".\..\functions\initialize.txt"
	#include_function ".\..\functions\color_set.txt"
	#include_function ".\..\functions\function.txt"
}
